/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;
import AO.Login;
import dbconnector.DBDriver;
import java.sql.PreparedStatement;

/**
 *
 * @author Administrator
 */
public class LoginDAO 
{
      public static boolean save(Login u)
    throws Exception
  {
    try
    {
      
      PreparedStatement pstmt = DBDriver.getPrepare("insert into login values(?,?,?,?,?,?,null)");
      pstmt.setString(1,u.getUserid());
      pstmt.setString(2, u.getPassword());
      pstmt.setString(3, u.getType());
      pstmt.setBoolean(4,u.getIsLoggedin());
      pstmt.setBoolean(5, u.getIsEnabled());
      pstmt.setString(6, u.getEmail());
      int i=pstmt.executeUpdate();
      if(i==1)
          return true;
    }
    catch (Exception e) {
        return false;
    }
    return false;
  }

}
